package com.phoenix.service.impl;

import com.phoenix.entity.Events;
import com.phoenix.entity.UserMember;
import com.phoenix.mapper.EventsMapper;
import com.phoenix.service.EventsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Service
public class EventsServiceImpl implements EventsService {
    @Autowired
    EventsMapper eventsMapper;

    @Override
    public List<Events> selectNSearch(Map<String, Object> search) {
        return eventsMapper.selectNSearch(search);
    }

    @Override
    public Boolean addEvents(Events events) {
        Date date = new Date();// 获取当前时间
        events.setEventsSendDate(date);
        return eventsMapper.addEvents(events);
    }

    @Override
    public Boolean updateEvents(Events events) {
        Date date = new Date();// 获取当前时间
        events.setEventsSendDate(date);
        return eventsMapper.updateEvents(events);
    }

    @Override
    public Boolean deleteEvents(List<String> IDList) {
        return eventsMapper.deleteEvents(IDList);
    }

    @Override
    public Boolean deleteEventsByID(Integer eventsID) {
        return eventsMapper.deleteEventsByID(eventsID);
    }

    @Override
    public Events selectEventsByID(Integer eventsID) {
        return eventsMapper.selectEventsByID(eventsID);
    }
}
